package com.ruoyi.web.controller.design;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.design.domain.ProductInfo;
import com.ruoyi.design.domain.vo.ProductInfoVO;
import com.ruoyi.design.service.IProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/design/info")
public class ProductInfoController  extends BaseController {

    @Autowired
    private IProductInfoService productInfoService;

    @GetMapping("/list")
    public TableDataInfo list(ProductInfo productInfo)
    {
        startPage();
        List<ProductInfo> list = productInfoService.selectProductInfoList(productInfo);
        return getDataTable(list,null);
    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody ProductInfoVO productInfo)
    {
//        System.out.println("productInfo==="+productInfo);
        int rows = productInfoService.insertProductInfo(productInfo);
        return rows > 0 ? AjaxResult.success() : AjaxResult.error();
    }
}
